package edu.njust.domain.user;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.sql.Date;
import java.util.Objects;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class BaseUser {
    protected String createdUser;
    protected Date createdTime;
    protected String modifiedUser;
    protected Date modifiedTime;

    @Override//重写了equals函数
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BaseUser that = (BaseUser) o;
        return Objects.equals(createdUser, that.createdUser)
                && Objects.equals(createdTime, that.createdTime)
                && Objects.equals(modifiedUser, that.modifiedUser)
                && Objects.equals(modifiedTime, that.modifiedTime);
    }

    @Override//重写了hashCode函数
    public int hashCode() {
        return Objects.hash(createdUser, createdTime, modifiedUser, modifiedTime);
    }
}
